<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改活动')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: summernote-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-activity-edit" th:object="${cstActivity}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">活动标题：</label>
            <div class="col-sm-8">
                <textarea name="title" class="form-control">[[*{title}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动简介：</label>
            <div class="col-sm-8">
                <textarea name="brief" class="form-control">[[*{brief}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="startTime" th:value="${#dates.format(cstActivity.startTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="endTime" th:value="${#dates.format(cstActivity.endTime, 'yyyy-MM-dd')}"
                           class="form-control" placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">活动栏目：</label>
            <div class="col-sm-8">
                <select name="category" class="form-control m-b" th:field="*{category}">
                    <option th:each="menu:${menus}" th:value="${menu.menuId}" th:text="${menu.menuName}"></option>
                </select>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">联系人：</label>
            <div class="col-sm-8">
                <input name="contacter" th:field="*{contacter}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动地址：</label>
            <div class="col-sm-8">
                <textarea name="address" class="form-control">[[*{address}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">联系电话：</label>
            <div class="col-sm-8">
                <input name="phone" th:field="*{phone}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动海报：</label>
            <div class="col-sm-8">
                <div class="file-loading">
                    <input id="filePath" class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">内容：</label>
            <div class="col-sm-8">
                <div class="ibox-content no-padding">
                    <textarea name="content" class="summernote" th:field="*{content}">
                    </textarea>
                </div>
            </div>
        </div>
        <!-- <div class="form-group">
             <label class="col-sm-3 control-label">现场签到审核人员：</label>
             <div class="col-sm-8">
                 <input name="mid" th:field="*{mid}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">发起支部：</label>
             <div class="col-sm-8">
                 <input name="groupName" th:field="*{groupName}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">发布时间：</label>
             <div class="col-sm-8">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                     <input name="publishTime" th:value="${#dates.format(cstActivity.publishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                 </div>
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">0普通类型：</label>
             <div class="col-sm-8">
                 <input name="tpe" th:field="*{tpe}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">0 无限制(人数限制）：</label>
             <div class="col-sm-8">
                 <input name="personLimit" th:field="*{personLimit}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">奖励规则ID：</label>
             <div class="col-sm-8">
                 <input name="eventCode" th:field="*{eventCode}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">图集：</label>
             <div class="col-sm-8">
                 <textarea name="photos" class="form-control">[[*{photos}]]</textarea>
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">是否已通知：</label>
             <div class="col-sm-8">
                 <input name="isNotify" th:field="*{isNotify}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">关联新闻的ID：</label>
             <div class="col-sm-8">
                 <textarea name="newsids" class="form-control">[[*{newsids}]]</textarea>
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">点击数：</label>
             <div class="col-sm-8">
                 <input name="clickCount" th:field="*{clickCount}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">点赞数：</label>
             <div class="col-sm-8">
                 <input name="likes" th:field="*{likes}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">0未上报，1已上报：</label>
             <div class="col-sm-8">
                 <input name="isReport" th:field="*{isReport}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">0 未审，1通过，2不通过：</label>
             <div class="col-sm-8">
                 <div class="radio-box" th:each="dict : ${@dict.getType('sys_check_status')}">
                     <input type="radio" th:id="${'isCheck_' + dict.dictCode}" name="isCheck" th:value="${dict.dictValue}" th:field="*{isCheck}">
                     <label th:for="${'isCheck_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                 </div>
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">不通过原因：</label>
             <div class="col-sm-8">
                 <input name="checkCase" th:field="*{checkCase}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">0 未审，1通过，2不通过：</label>
             <div class="col-sm-8">
                 <input name="checkTime" th:field="*{checkTime}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">审核人：</label>
             <div class="col-sm-8">
                 <input name="checkUser" th:field="*{checkUser}" class="form-control" type="text">
             </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">参与人数：</label>
             <div class="col-sm-8">
                 <input name="joincount" th:field="*{joincount}" class="form-control" type="text">
             </div>
         </div>-->
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: summernote-js"/>
<script type="text/javascript">
    $(function () {
        $('.summernote').summernote({
            lang: 'zh-CN'
        });
    });

    var prefix = ctx + "activity/activity";
    $("#form-activity-edit").validate({
        focusCleanup: true
    });

    /*function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-activity-edit').serialize());
        }
    }*/

    function submitHandler() {
        /*$.operate.save(prefix + "/add", $('#form-article-add').serialize());*/
        //文件上传
        var form = $("#form-activity-edit")[0];
        var formData = new FormData(form);
        /*formData.append('file', files[0]);*/
        /*if ($('#filePath')[0].files[0] == null) {
            $.modal.alertWarning("请先选择文件路径");
            return false;
        }*/
        formData.append('file', $('#filePath')[0].files[0]);
        $.ajax({
            url: prefix + "/edit",
            type: 'post',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            dataType: "json",
            success: function (result) {
                console.log(result)
                setTimeout(function () {
                    $.modal.close();
                }, 300);
                var parent = window.parent;
                parent.$.modal.msgSuccess("操作成功!");
                parent.$.table.refresh();
            }
        });
    };

    $("input[name='publishTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='startTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='endTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='addTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>